// 1.编写获取评到列表的逻辑
import { useState, useEffect } from "react"
import { getChannelAPI } from "../apis/arrticle"

export function useChannel(){
const [article, setArticle] = useState([])

    useEffect(()=>{
        const getChannelList=async()=>{
          const res=  await getChannelAPI()
          setArticle(res.data.channels)
        }
        getChannelList()
    },[])
//2.把组件中要用到的数据return出去
    return {
        article
    }
}
